package com.example.fbi_text.views;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.fbi_text.R;

public class Mainitem01View extends RelativeLayout {
    private TextView mtitle;
    private TextView mauthor;
    private TextView mTime;

    public Mainitem01View(Context context) {
        super(context);
        initView();
    }

    public Mainitem01View(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }
    public void initView(){
        LayoutInflater.from(getContext()).inflate(R.layout.main_item01,this,true);
        mtitle = findViewById(R.id.main_item01_title);
        mauthor = findViewById(R.id.main_item01_author);
        mTime = findViewById(R.id.main_item01_time);
    }
    public void setmtitle(String title){
        if (mtitle != null && !TextUtils.isEmpty(title)){
            mtitle.setText(title);
        }
    }
    public void setMauthor(String author){
        if (mauthor != null && !TextUtils.isEmpty(author)){
            mauthor.setText(author);
        }
    }
    public void setmTime(String time){
        if (mTime != null && !TextUtils.isEmpty(time)){
            mTime.setText(time);
        }
    }

}
